﻿$(document).ready(function () {

    $("#choose").click(function () {

        $('#list_images').dialog({
            show: {
                effect: 'slide',
                height: 1200,
                width: 900,
                maxHeight: 1200,
                maxWidth: 900,
                complete: function () {
                    //thuc hien load danh sach hinh anh o day
                    $.post("/Image/GetAll",
               function (e) {

                   $("#list_items").empty();
                   $("#list_items").append(e);

               });
                }
            },
            open: function (event, ui) {
                console.log('open');
            }
        });
    });
    $('#myForm').ajaxForm(function (e) {
        if (e.hasOwnProperty("error")) {

            alert(e.error);
        } else {
            $("#list_items").append(e);
        }

    });
});
function hover(item) {
    $(item).addClass("image_active");
}
function outfunction(item) {
    $(item).removeClass("image_active");
}
function chooseImage(item) {

    var imageLink = $(item).attr("src");
    $("#list_images").dialog("close");
    $("#choose").attr("src", imageLink);
    $("input[name='Image']").val(imageLink);
}